import React from 'react';
import { Tooltip, Button } from 'antd';
import Zcon from '@cbd/icon';
import styles from './FormTopBar.less';

const FormTopBar = ({
  className = '',
  previewForm = () => { },
  formConfig = {},
  onPrePage = () => { },
  onSave = () => { },
}) => {
  return (
    <div className={`${className} ${styles.content}`}>
      <div className={`${styles.topBar}`}>
        <span className={`${styles.item} ${styles.cursor}`} onClick={onSave}>
          <Tooltip placement="top" title='保存'>
            <Zcon type="save" />
          </Tooltip>
        </span>
        <span className={styles.separator} />
        <span className={`${styles.item} ${styles.cursor}`} onClick={onPrePage}>
          返回上一级
        </span>
        <span className={styles.separator} />
        <span className={styles.item}>
          {formConfig.name || ''}
        </span>
      </div>
      <Button type="primary" onClick={previewForm}>预览</Button>
    </div>
  );
}
export default FormTopBar;